package com.elm_springboot_s.mapper;

import com.elm_springboot_s.pojo.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {
    
    @Select("SELECT * FROM user WHERE userName = #{userName} AND password = #{password}")
    User getUserByNameAndPass(String userName, String password);
    
    @Select("SELECT * FROM user WHERE userName = #{userName}")
    User getUserByName(String userName);
    
    @Insert("INSERT INTO user (password, userName, userSex) " +
            "VALUES (#{password}, #{userName}, #{userSex})")
    @Options(useGeneratedKeys = true, keyProperty = "userId")
    int saveUser(User user);
} 